package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.WorkerMapper;
import com.ruoyi.system.domain.Worker;
import com.ruoyi.system.service.IWorkerService;

/**
 * 工人Service业务层处理
 * 
 * @author sizegang
 * @date 2024-06-29
 */
@Service
public class WorkerServiceImpl implements IWorkerService 
{
    @Autowired
    private WorkerMapper workerMapper;

    /**
     * 查询工人
     * 
     * @param id 工人主键
     * @return 工人
     */
    @Override
    public Worker selectWorkerById(Long id)
    {
        return workerMapper.selectWorkerById(id);
    }

    /**
     * 查询工人列表
     * 
     * @param worker 工人
     * @return 工人
     */
    @Override
    public List<Worker> selectWorkerList(Worker worker)
    {
        return workerMapper.selectWorkerList(worker);
    }

    /**
     * 新增工人
     * 
     * @param worker 工人
     * @return 结果
     */
    @Override
    public int insertWorker(Worker worker)
    {
        worker.setCreateTime(DateUtils.getNowDate());
        return workerMapper.insertWorker(worker);
    }

    /**
     * 修改工人
     * 
     * @param worker 工人
     * @return 结果
     */
    @Override
    public int updateWorker(Worker worker)
    {
        worker.setUpdateTime(DateUtils.getNowDate());
        return workerMapper.updateWorker(worker);
    }

    /**
     * 批量删除工人
     * 
     * @param ids 需要删除的工人主键
     * @return 结果
     */
    @Override
    public int deleteWorkerByIds(Long[] ids)
    {
        return workerMapper.deleteWorkerByIds(ids);
    }

    /**
     * 删除工人信息
     * 
     * @param id 工人主键
     * @return 结果
     */
    @Override
    public int deleteWorkerById(Long id)
    {
        return workerMapper.deleteWorkerById(id);
    }
}
